//更改state
import { setCookies,removeCookies } from "./cookies";

const mutations={
    //登录
     set_Login(state,user){
    debugger
      state.user.id=user.id;
      state.user.parkid=user.parkid;
      state.user.entid=user.entid;
      state.user.loginname=user.loginname;
      state.user.name=user.name;
      state.user.email=user.email;
      state.user.mobile=user.mobile;
      state.user.remark=user.remark;
      state.user.type=user.type;
      state.user.addtime=user.addtime;
      state.user.token=user.token;
      state.user.islogin=true;
      setCookies("id",user.id);
      setCookies("parkid",user.parkid);
      setCookies("entid",user.entid);
      setCookies("loginname",user.loginname);
      setCookies("name",user.name);
      setCookies("email",user.email);
      setCookies("mobile",user.mobile);
      setCookies("remark",user.remark);
      setCookies("type",user.type);
      setCookies("addtime",user.addtime);
      setCookies("token",user.token);
      setCookies("islogin",true);
      
     },

     //注销
     set_LogOut(state){
      
      state.user.id="";
      state.user.parkid="";
      state.user.entid="";
      state.user.loginname="";
      state.user.name="";
      state.user.email="";
      state.user.mobile="";
      state.user.remark="";
      state.user.type="";
      state.user.addtime="";
      state.user.token="";
      state.user.islogin=false;
      removeCookies("id");
      removeCookies("parkid");
      removeCookies("entid");
      removeCookies("loginname");
      removeCookies("name");
      removeCookies("email");
      removeCookies("mobile");
      removeCookies("remark");
      removeCookies("type");
      removeCookies("addtime");
      removeCookies("token");
      setCookies("islogin",false);
     },

     //消息提示
     set_MsgContent(state,value){
        state.msg.content=value;
     }


}
export default mutations